package com.arvin.service.serviceImpl;

import com.arvin.mapper.ScoreMapper;
import com.arvin.pojo.PageBean;
import com.arvin.pojo.ScoreInfo;
import com.arvin.service.ScoreService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScoreServiceImpl implements ScoreService {

    @Autowired
    private ScoreMapper scoreMapper;

    /**
     * 成绩查询
     * @param page
     * @param pageSize
     * @param studentId
     * @param stuName
     * @return
     */
    public PageBean getScoreInfo(Integer page, Integer pageSize, String studentId, String stuName,String className) {
        PageHelper.startPage(page,pageSize);
        List<ScoreInfo> scoreInfoList = scoreMapper.getScoreInfo(studentId,stuName,className);
        Page<ScoreInfo> scoreInfoPage = (Page<ScoreInfo>) scoreInfoList;
        PageBean pageBean = new PageBean(scoreInfoPage.getTotal(),scoreInfoPage.getResult());
        return pageBean;
    }
}
